<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <title>主辅棋</title>
    <style>
        textarea {
            height: 500px;
            font-family: unifik, sans-serif;
        }

        table {
            margin: 0 auto;
        }
    </style>
    <script src="https://cdn.jsdelivr.net/npm/js-md5@0.8.3/src/md5.min.js"></script>
    <script>
        function genUrl() {
            const id = Math.random().toString(36).substr(2, 6);
            const url = "http://teg.guc1010.top/" + id + "/";
            const blackSalt = '2057101615';
            const blackHash = md5(id + blackSalt).substr(0, 6);
            const whiteSalt = '2025011516';
            const whiteHash = md5(id + whiteSalt).substr(0, 6);
            document.getElementById("blackUrl").innerHTML = url + blackHash;
            document.getElementById("blackUrl").href = url + blackHash;
            document.getElementById("whiteUrl").innerHTML = url + whiteHash;
            document.getElementById("whiteUrl").href = url + whiteHash;
            document.getElementById("watchUrl").innerHTML = url;
            document.getElementById("watchUrl").href = url;
            document.getElementById("urlBox").hidden = false;
        }
    </script>
    <link rel="stylesheet" href="../css/pajne.css">
    <link rel="stylesheet" href="../Seniva/stylesheet.css">
</head>

<body>
    <h1>主辅棋 | Tegojafo</h1>
    <a href="..">◀ 返回上层 (Back)</a>
    <p>
        臤徘斯发明的新棋 (A Board Game by Kinboise)
    </p>
    <p>
        <div class="label">规则 (Rules)</div>
        <div class="card lab">
            <ul>
                <li>
                    <a href="https://newchessbar.fandom.com/zh/wiki/%E4%B8%BB%E8%BE%85%E6%A3%8B">新棋吧 Wiki</a>
                </li>
            </ul>
        </div>
        </p>
    <p>
    <div class="label">对局 (Play)</div>
    <div class="card lab">
        <p>
            人人对局：若两人使用同一设备，则进入「本地对局」，轮流操作；若使用不同设备，点击「联机对局」生成链接。
        </p><p>
            人机对局：前往「本地对局」，打开右侧边栏的「AI」选项卡，点击「play」（或按 2 键）可让机器人走一步；下方可调节「iterations」和「playoutDepth」，值越大则棋力越强、计算越慢。人机对战建议调小，否则运算耗时太长。
        </p>
        <ul>
            <li>
                <a href="http://teg.guc1010.top/">本地对局 (Local Game)</a>
            </li><br>
            <li>
                <a onclick="genUrl()" href="#urlBox">联机对局 (Remote Multiplayer)</a>
            </li>
        </ul>
    </div>
    </p>
    <p>
    <div class="card" id="urlBox" hidden>
        <strong>已生成链接，请选择黑白，并将另一链接发送给对手。</strong>
        <ul>
            <li>打开此链接控制黑棋：<a href="" id="blackUrl" target="_blank"></a></li><br>
            <li>打开此链接控制白棋：<a href="" id="whiteUrl" target="_blank"></a></li><br>
            <li>打开此链接可以观战：<a href="" id="watchUrl" target="_blank"></a></li>
        </ul>
    </div>
    </p>
</body>

</html>